<a class="menu-toggler" id="menu-toggler" href="#">
    <span class="menu-text"></span>
</a>

<?php
$arrAyMenu = array(
    'default' => array(
        'parent' => array(
            'link' => Yii::app()->createUrl('systems/default'),
            'icon' => '<i class="icon-dashboard"></i>',
            'name' => '<span class="menu-text"> Dashboard </span>'
        ),
    ),
    'menu' => array(
        'parent' => array(
            'link' => Yii::app()->createUrl('systems/menu'),
            'icon' => '<i class="icon-list"></i>',
            'name' => '<span class="menu-text"> Quản lý menu </span>'
        ),
    ),
    'product' => array(
        'parent'=> array(
        'link'=> '#',
        'icon'=>'<i class="icon-coffee"></i>',
        'name'=>'<span class="menu-text"> Quản lý sản phẩm </span><b class="arrow icon-angle-down"></b>'
        ),   
    'submenu'=> array(
       'event_category'=>array(
        'link'=> Yii::app()->createUrl('systems/category/index'),
        'icon'=>'<i class="icon-double-angle-right"></i>',
        'name'=>'Danh mục sản phẩm'
        ),                             
       'index'=>array(
        'link'=> Yii::app()->createUrl('systems/product/index'),
        'icon'=>'<i class="icon-double-angle-right"></i>',
        'name'=>'Sản phẩm'
        ),                             
       ),   
    ),
    'news' => array(
        'parent' => array(
            'link' => Yii::app()->createUrl('systems/news'),
            '<i class="icon-tag"></i>',
            'name' => '<span class="menu-text"> Quản lý tin tức </span>'
        ),
    ),
    'cms' => array(
        'parent' => array(
            'link' => Yii::app()->createUrl('systems/cms'),
            'icon' => '<i class="icon-credit-card "></i>',
            'name' => '<span class="menu-text"> Quản lý trang tĩnh </span>'
        ),
    ),
    'slide' => array(
        'parent' => array(
            'link' => Yii::app()->createUrl('systems/slide'),
            '<i class="icon-picture"></i>',
            'name' => '<span class="menu-text"> Slideshow </span>'
        ),
    ),
    'website' => array(
        'parent' => array(
            'link' => Yii::app()->createUrl('systems/website'),
            '<i class="icon-list-alt"></i>',
            'name' => '<span class="menu-text"> Quản lý site liên kết </span>'
        ),
    ),
    
    'project' => array(
        'parent' => array(
            'link' => Yii::app()->createUrl('systems/project'),
            '<i class="icon-fa-money fa fa-money fa-lg"></i>',
            'name' => '<span class="menu-text"> Quản lý dự án </span>'
        ),
    ),
    'partner' => array(
        'parent' => array(
            'link' => Yii::app()->createUrl('systems/partner'),
            '<i class="icon-desktop"></i>',
            'name' => '<span class="menu-text"> Quản lý đối tác </span>'
        ),
    ),
    'users' => array(
            'parent' => array(
                'link' => Yii::app()->createUrl('systems/manageadmin'),
                'icon' => '<i class="icon-user"></i>',
                'name' => 'Manage User'
        ),
    ),
    
//    'emailtemplates' => array(
//        'parent' => array(
//            'link' => Yii::app()->createUrl('systems/emailtemplates'),
//            'icon' => '<i class="icon-envelope-alt "></i>',
//            'name' => '<span class="menu-text"> Email Templates</span>'
//        ),
//    ),
//    'booked' => array(
//        'parent' => array(
//            'link' => Yii::app()->createUrl('systems/booked'),
//            'icon' => '<i class="icon-certificate "></i>',
//            'name' => '<span class="menu-text"> Booked Management</span>'
//        ),
//    ),
    'setting' => array(
        'parent' => array(
            'link' => Yii::app()->createUrl('systems/setting'),
            'icon' => '<i class="icon-cogs"></i>',
            'name' => '<span class="menu-text"> Settings </span>'
        ),
    ),
);

$htmlMenu = '<li><a href="link">icon name </a></li>';
$htmlMenuParent = '<a href="" class="dropdown-toggle">iconpar';
?>



<div class="sidebar" id="sidebar">
    <ul class="nav nav-list">
<?php
if (count($arrAyMenu) > 0):
    if (Yii::app()->user->role_id > 2) {
        $arrAccess = MyFunctionCustom::$arrAcess;
        $menuAccess = $arrAccess[Yii::app()->user->role_id];
        $tmp = array();
        if (count($menuAccess) > 0): foreach ($menuAccess as $access):
                $tmp[$access] = $arrAyMenu[$access];
            endforeach;
        endif;
        $arrAyMenu = $tmp;
    }

    foreach ($arrAyMenu as $menu):
        if (!isset($menu['submenu'])) {
            echo str_replace(array('link', 'icon', 'name'), $menu['parent'], $htmlMenu);
        } else {
            echo "<li>";
            echo '<a href="" class="dropdown-toggle">';
            echo $menu['parent']['icon'] . $menu['parent']['name'];
            echo '</a>';
            //submenu
            echo "<ul class='submenu'>";
            if (count($menu['submenu']) > 0):
                foreach ($menu['submenu'] as $submenu):
                    echo str_replace(array('link', 'icon', 'name'), $submenu, $htmlMenu);
                endforeach;
            endif;
            echo "</ul>";
            echo "</li>";
        }
    endforeach;
endif;
?>

        <!--        
                <li>
                    <a href="<?php echo Yii::app()->createUrl('systems/default'); ?>">
                        <i class="icon-dashboard"></i>
                        <span class="menu-text"> Dashboard </span>
                    </a>
                </li>
                <li>
                    <a href="" class="dropdown-toggle">
                        <i class="icon-coffee"></i>
                        <span class="menu-text"> Events </span>
                        <b class="arrow icon-angle-down"></b>
                    </a>
                    <ul class="submenu">
                        <li>
                            <a href="<?php echo Yii::app()->createUrl('systems/event/event_category'); ?>">
                                <i class="icon-double-angle-right"></i>
                                Events Category
                            </a>
                        </li>
        
                        <li>
                            <a href="<?php echo Yii::app()->createUrl('systems/event/index'); ?>">
                                <i class="icon-double-angle-right"></i>
                                Events Management
                            </a>
                        </li>
                    </ul>
                </li>
                <li>
                    <a href="<?php echo Yii::app()->createUrl('systems/ticket'); ?>">
                        <i class="icon-fa-money fa fa-money fa-lg"></i>
                        <span class="menu-text"> Ticket </span>
                    </a>
                </li>
                <li>
                    <a href="<?php echo Yii::app()->createUrl('systems/gallery'); ?>">
                        <i class="icon-picture"></i>
                        <span class="menu-text"> Gallery </span>
                    </a>
                </li>
                <li>
                    <a href="<?php echo Yii::app()->createUrl('systems/language'); ?>">
                        <i class="icon-book"></i>
                        <span class="menu-text"> Languages </span>
                    </a>
                </li>
                <li>
                    <a href="<?php echo Yii::app()->createUrl('systems/users'); ?>">
                        <i class="icon-user"></i>
                        <span class="menu-text"> Users Management </span>
                    </a>
                </li>
                <li>
                    <a href="<?php echo Yii::app()->createUrl('systems/setting'); ?>">
                        <i class="icon-cogs"></i>
                        <span class="menu-text"> Settings </span>
                    </a>
                </li>-->
    </ul><!--/.nav-list-->

    <div class="sidebar-collapse" id="sidebar-collapse">
        <i class="icon-double-angle-left"></i>
    </div>
</div>